Ubuntu下使用valgrind所遇问题 | 您所在的位置:网站首页 › make install error 1 › Ubuntu下使用valgrind所遇问题 |
一、Valgrind的安装 a、直接使用sudo apt-get install valgrind b、valgrind官网下载http://valgrind.org/ #解压 sudo tar xvf valgrind-3.8.1.tar.bz2 -C /home/worspace/ #安装 ./configure make sudo make install运行: $valgrind ls -l 出现以下问题: ==18092== Memcheck, a memory error detector ==18092== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. ==18092== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info ==18092== Command: ls -l ==18092== valgrind: Fatal error at startup: a function redirection valgrind: which is mandatory for this platform-tool combination valgrind: cannot be set up. Details of the redirection are: valgrind: valgrind: A must-be-redirected function valgrind: whose name matches the pattern: index valgrind: in an object with soname matching: ld-linux.so.2 valgrind: was not found whilst processing valgrind: symbols from the object with soname: ld-linux.so.2 valgrind: valgrind: Possible fixes: (1, short term): install glibc's debuginfo valgrind: package on this machine. (2, longer term): ask the packagers valgrind: for your Linux distribution to please in future ship a non- valgrind: stripped ld.so (or whatever the dynamic linker .so is called) valgrind: that exports the above-named function using the standard valgrind: calling conventions for this platform. The package you need valgrind: to install for fix (1) is called valgrind: valgrind: On Debian, Ubuntu: libc6-dbg valgrind: On SuSE, openSuSE, Fedora, RHEL: glibc-debuginfo valgrind: valgrind: Cannot continue -- exiting now. Sorry.二、解决办法 仔细阅读上边的log信息, Possible fixes: (1, short term): install glibc's debuginfo On Debian, Ubuntu: libc6-dbg ok,执行命令sudo apt-get install libc6-dbg 安装完成后,问题解决 三、使用方法(valgrind --help) valgrind --leak-check=yes --show-reachable=yes ls -l 以下是截取的结果分析: ==11283== LEAK SUMMARY: ==11283== definitely lost: 80 bytes in 2 blocks ==11283== indirectly lost: 240 bytes in 20 blocks ==11283== possibly lost: 0 bytes in 0 blocks ==11283== still reachable: 13,405 bytes in 23 blocks ==11283== suppressed: 0 bytes in 0 blocks 运行自己的app: valgrind --leak-check=full --track-origins=yes --show-reachable=yes ./packapp 0 0 HW9_Multimedia_256MDDR_128MFlash_CTT2_mnt.ini 结果分析: ==11295== HEAP SUMMARY: ==11295== in use at exit: 0 bytes in 0 blocks ==11295== total heap usage: 29 allocs, 29 frees, 70,080,768 bytes allocated 可以看到堆栈heap分配了29次,释放了29次。没有reachable的block四、遗留的问题 上述关于ld-linux.so.2,non stripped ld.so,应该是关于编译链接的问题,需要好好看看《编译原理》了。 |
CopyRight 2018-2019 实验室设备网 版权所有 |